package com.hualude.roadsign.repository;

import com.hualude.roadsign.dto.*;
import com.hualude.roadsign.model.RoadsignEntity;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.math.BigInteger;
import java.util.Collection;
import java.util.List;

/**
 * Created by anqian on 2017/4/7.
 */
public interface CountRepository extends CrudRepository<RoadsignEntity, Long> {


    /**
     * @Description: 标牌统计获取用于DT显示
     * @Author: lin-anqian
     * @Date: 2017/4/7 14:58
     */
    public Integer getCount4DT(String timeLimit, String installType, String signFixed, String signType, String orgName, Integer actor, String orgIds) throws Exception;

    /**
     * @Description: 获取用于DT显示的标牌统计
     * @Author: lin-anqian
     * @Date: 2017/4/7 14:59
     */
    public List<RoadsignDto> getRoadSign4DT(DTRequestDto dtRequestDto, Integer actor, String orgIds) throws Exception;


    /**
     * @Description: 用于首页的标牌统计
     * @author chenzetong
     * @date 2017/4/7 19:13
     */
    public Integer getRoadSignCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 用于首页的标杆统计
     * @author chenzetong
     * @date 2017/4/8 16:00
     */
    public Integer getRoadPoleCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 窨井统计
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午4:27
     */
    public Integer getCoverCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 限高杆统计
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午4:27
     */
    public Integer getHighLeverCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 护栏统计
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午4:27
     */
    public Integer getGuardrailCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 监控箱统计
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午4:27
     */
    public Integer getMonitorCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 标线统计
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午4:27
     */
    public Integer getRoadLineCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 信号灯统计
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午4:27
     */
    public Integer getSignalLampCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 信号机统计
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午4:27
     */
    public Integer getSignalMachineCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 太阳能统计
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午4:27
     */
    public Integer getSolarEnergyCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 标杆统计datatables4DT count
     * @Author: lin-anqian
     * @Date: 2017/4/8 22:09
     */
    public Integer getRoadPoleCount4DT(DTRequestDto dtRequestDto, Integer actor, String orgIds) throws Exception;

    /**
     * @Description: 标杆统计datatables4DT
     * @Author: lin-anqian
     * @Date: 2017/4/8 22:10
     */
    public List<RoadpoleDto> getRoadPole4DT(DTRequestDto dtRequestDto, Integer actor, String orgIds) throws Exception;

    /**
     * @Description: 获取标杆表中的相关的道路名--联动道路名选择框
     * @Author: lin-anqian
     * @Date: 2017/4/9 15:29
     */
    public List<String> getRoadNames(String provinceName, String cityName, String areaName, String orgId, Integer actor) throws Exception;

    /**
     * @Description: 获取标杆表中的所有相关的区域名
     * @Author: lin-anqian
     * @Date: 2017/4/9 15:47
     */
    public List<String> getAllAreaName(String orgIds, String provinceName, String cityName) throws Exception;


    /**
     * @Description: 得到所有相关的主管公司名和ID
     * @Author: lin-anqian
     * @Date: 2017/4/9 16:12
     */
    public List<OrgDto> getAllOrg(String orgIds) throws Exception;

    /**
     * @Description: 故障统计4DT count 上报表
     * @Author: lin-anqian
     * @Date: 2017/4/10 12:28
     */
    public Integer getFaultCount4DT(DTRequestDto dtRequestDto, Integer actor, String orgIds) throws Exception;

    /**
     * @Description: 故障统计4DT上报表
     * @Author: lin-anqian
     * @Date: 2017/4/10 12:29
     */
    public List<SignfaultDto> getFault4DT(DTRequestDto dtRequestDto, Integer actor, String orgIds) throws Exception;

    /**
     * @param dtRequestDto
     * @param actor
     * @param orgIds
     * @param userId
     * @Description: 故障统计4DT处理表 count
     * @Author: lin-anqian
     * @Date: 2017/4/12 0:30
     */
    public Integer getMaintenanceCount4DT(DTRequestDto dtRequestDto, Integer actor, String orgIds, Integer userId) throws Exception;

    /**
     * @Description: 故障统计4DT处理表
     * @Author: lin-anqian
     * @Date: 2017/4/12 0:31
     */
    public List<MaintenanceDto> getMaintenance4DT(DTRequestDto dtRequestDto, Integer actor, String orgIds, Integer userId) throws Exception;

    /**
     * @Description: 判断是否是管理员
     * @Author: lin-anqian
     * @Date: 2017/4/10 19:59
     */
    @Query(value = "select count(*) from UserActorEntity where actorId =1 and userId = ?1")
    public Integer isManager(Integer userId) throws Exception;

    /**
     * @Description: 获取该用户的所有角色
     * @Author: lin-anqian
     * @Date: 2017/4/10 21:30
     */
    public String getactorIds(Integer userId) throws Exception;

    /**
     * @Description: 获取该公司的子公司
     * @Author: lin-anqian
     * @Date: 2017/4/10 21:30
     */
    public String getChildOrgIds(Integer orgId) throws Exception;

    /**
     * @Description: 相关维护单位
     * @Author: lin-anqian
     * @Date: 2017/4/12 23:01
     */
    public List<OrgDto> getDealOrg(String orgIds) throws Exception;

    /**
     * @Description: 得到该维护公司在某年的处理数量
     * @Author: lin-anqian
     * @Date: 2017/4/13 15:01
     */
    public List<String> getOrgYearDealTimes(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 得到该维护公司在某年的上报数量
     * @Author: lin-anqian
     * @Date: 2017/4/13 15:02
     */
    public List<String> getOrgyearTalkTimes(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 获得所有公司的ID
     * @Author: lin-anqian
     * @Date: 2017/4/13 19:02
     */
    public String getOrgIds() throws Exception;

    /**
     * @Description: 用于首页标牌待审核数量
     * @author chenzetong
     * @date 2017/4/16 22:13
     */
    @Query(value = "select count(*) from RoadpoleEntity r where r.orgId=?1 and r.roadPoleIsComplete=0")
    public Integer getUnAuditSingCount(Integer orgId) throws Exception;

    /**
     * @Description: 根据主管单位得到养护公司
     * @Author: lin-anqian
     * @Date: 2017/4/22 21:35
     */
    public List<OrgDto> getConservationOrg(Integer mainOrgId, String orgIds, Integer actor) throws Exception;

    /**
     * @Description: 得到标杆表中的全部省份
     * @Author: lin-anqian
     * @Date: 2017/4/9 15:47
     */
    public List<String> getProvinceName(String orgIds) throws Exception;

    /**
     * @Description: 按照省份得到城市
     * @Author: lin-anqian
     * @Date: 2017/4/23 19:47
     */
    public List<String> getCityName(String orgIds, String provinceName) throws Exception;

    /**
     * @Description: 获取起始路段
     * @Author: lin-anqian
     * @Date: 2017/4/23 21:49
     */
    public List<String> getStartRoadName(String orgIds, String provinceName, String cityName, String areaName,
                                         String endRoadName, String roadName) throws Exception;

    /**
     * @Description: 根据起始路段获取终止路段
     * @Author: lin-anqian
     * @Date: 2017/4/23 21:52
     */
    public List<String> getEndRoadName(String orgIds, String startRoad, String provinceName, String cityName, String areaName, String roadName) throws Exception;

    /**
     * @Description: 得到按标志分类各个标志的数量
     * @Author: lin-anqian
     * @Date: 2017/4/25 18:52
     */
    public List<Integer> getPerSignCounts(String orgIds, String time, String province, String city, String area, String road) throws Exception;

    /**
     * @Description: 标牌道路DTO4数量
     * @Author: lin-anqian
     * @Date: 2017/5/4 23:36
     */
    public Integer getRoadSignPole4DTCount(DTRequestDto dtRequestDto, Integer actor, String orgIds, Integer userId) throws Exception;

    /**
     * @Description: 标牌道路DTO4
     * @Author: lin-anqian
     * @Date: 2017/5/4 23:36
     */
    public List<RoadpoleDto> getRoadSignPole4DT(DTRequestDto dtRequestDto, Integer actor, String orgIds, Integer userId) throws Exception;

    /**
     * @Description: count(*) 无法map
     * @Author: lin-anqian
     * @Date: 2017/5/5 2:16
     */
    public List<BigInteger> getRoadSignCounts(DTRequestDto dtRequestDto, Integer actor, String orgIds, Integer userId) throws Exception;

    /**
     * @Description: 按区域统计标牌
     * @Author: lin-anqian
     * @Date: 2017/5/5 21:51
     */
    public List<NameCountDto> getAreaRoadSignCount(String orgIds, String roadSignCity) throws Exception;

    /**
     * @param userId
     * @Description: 得到用户所在公司
     * @Author: lin-anqian
     * @Date: 2017/5/7 15:55
     */
    @Query(value = "SELECT u.orgId FROM UserEntity u WHERE u.userId = ?1")
    public Integer getRealOrgIds(Integer userId) throws Exception;

    /**
     * @Description:
     * @Author: lin-anqian
     * @Date: 2017/5/18 21:04
     */
    @Query(value = "SELECT r.roadSignType FROM RoadsignEntity r,RoadpoleEntity p, OrgEntity e WHERE r.roadPoleId = p.roadPoleId AND\n" +
            "r.orgId=e.orgId and p.province = ?1 AND p.city = ?2 AND p.area = ?3 AND p.roadName = ?5 AND e.orgName = ?4" +
            " ORDER BY r.roadSignType")
    public List<Integer> getPerSignCountsByRoad(String province, String city, String area, String orgName, String roadName) throws Exception;

    /**
     * @Description: 得到excel需要的信息
     * @Author: yang_jiaren
     * @Date: 2017/5/18 17:45
     */
    public List<RoadpoleDto> getRoadPole4Excel(String strSearch, Integer actor, String orgIds) throws Exception;

    /**
     * @Description: 按年月统计报修金额
     * @Author: lin-anqian
     * @Date: 2017/5/18 23:02
     */
    public List<MaintenanceDto> getOrgyearSpendMoney(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 标牌故障统计
     * @Author: shao-yikun
     * @Date: 2017/11/24 下午4:26
     */
    public Integer getSignFaultCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 窨井审核统计
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午5:15
     */
    public Integer getCoverAuditCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 窨井故障统计
     * @Author: shao-yikun
     * @Date: 2017/11/24 下午4:26
     */
    public Integer getCoverFaultCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 限高杆审核统计
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午5:15
     */
    public Integer getHighLeverAuditCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 限高杆故障统计
     * @Author: shao-yikun
     * @Date: 2017/11/24 下午4:26
     */
    public Integer getHighLeverFaultCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 护栏审核统计
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午5:15
     */
    public Integer getGuardrailAuditCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 护栏故障统计
     * @Author: shao-yikun
     * @Date: 2017/11/24 下午4:26
     */
    public Integer getGuardrailFaultCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 监控箱审核统计
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午5:15
     */
    public Integer getMonitorAuditCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 监控箱故障统计
     * @Author: shao-yikun
     * @Date: 2017/11/24 下午4:26
     */
    public Integer getMonitorFaultCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 标线审核统计
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午5:15
     */
    public Integer getRoadLineAuditCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 标线故障统计
     * @Author: shao-yikun
     * @Date: 2017/11/24 下午4:26
     */
    public Integer getRoadLineFaultCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 信号灯审核统计
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午5:15
     */
    public Integer getSignalLampAuditCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 信号灯故障统计
     * @Author: shao-yikun
     * @Date: 2017/11/24 下午4:26
     */
    public Integer getSignalLampFaultCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 信号机审核统计
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午5:15
     */
    public Integer getSignalMachineAuditCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 信号机故障统计
     * @Author: shao-yikun
     * @Date: 2017/11/24 下午4:26
     */
    public Integer getSignalMachineFaultCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 太阳能审核统计
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午5:15
     */
    public Integer getSolarEnergyAuditCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 太阳能故障统计
     * @Author: shao-yikun
     * @Date: 2017/11/24 下午4:26
     */
    public Integer getSolarEnergyFaultCount(Integer orgId, Integer actorId) throws Exception;

    /**
     * @Description: 得到该维护公司在某年窨井的处理数量
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午9:04
     */
    public List<String> getCoverOrgYearDealTimes(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 得到该维护公司在某年限高杆的处理数量
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午9:04
     */
    public List<String> getHighLeverOrgYearDealTimes(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 得到该维护公司在某年护栏的处理数量
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午9:04
     */
    public List<String> getGuardrailOrgYearDealTimes(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 得到该维护公司在某年监控箱的处理数量
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午9:04
     */
    public List<String> getMonitorOrgYearDealTimes(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 得到该维护公司在某年标线的处理数量
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午9:04
     */
    public List<String> getRoadLineOrgYearDealTimes(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 得到该维护公司在某年信号灯的处理数量
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午9:04
     */
    public List<String> getSignLampOrgYearDealTimes(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 得到该维护公司在某年信号机的处理数量
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午9:04
     */
    public List<String> getSignalMachineOrgYearDealTimes(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 得到该维护公司在某年窨井的处理数量
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午9:04
     */
    public List<String> getSolarEnergyOrgYearDealTimes(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 得到该维护公司在某年窨井的上报数量
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午9:12
     */
    public List<String> getCoverOrgyearTalkTimes(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 得到该维护公司在某年限高杆的上报数量
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午9:12
     */
    public List<String> getHighLeverOrgyearTalkTimes(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 得到该维护公司在某年护栏的上报数量
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午9:12
     */
    public List<String> getGuardrailOrgyearTalkTimes(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 得到该维护公司在某年监控箱的上报数量
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午9:12
     */
    public List<String> getMonitorOrgyearTalkTimes(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 得到该维护公司在某年标线的上报数量
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午9:12
     */
    public List<String> getRoadLineOrgyearTalkTimes(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 得到该维护公司在某年信号灯的上报数量
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午9:12
     */
    public List<String> getSignLampOrgyearTalkTimes(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 得到该维护公司在某年信号灯的上报数量
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午9:12
     */
    public List<String> getSignalMachineOrgyearTalkTimes(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 得到该维护公司在某年太阳能的上报数量
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午9:12
     */
    public List<String> getSolarEnergyOrgyearTalkTimes(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 按年月统计窨井报修金额
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午9:16
     */
    public List<MaintenanceDto> getCoverOrgyearSpendMoney(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 按年月统计限高杆报修金额
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午9:16
     */
    public List<MaintenanceDto> getHighLeverOrgyearSpendMoney(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 按年月统计护栏报修金额
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午9:16
     */
    public List<MaintenanceDto> getGuardrailOrgyearSpendMoney(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 按年月统计监控箱报修金额
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午9:16
     */
    public List<MaintenanceDto> getMonitorOrgyearSpendMoney(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 按年月统计标线报修金额
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午9:16
     */
    public List<MaintenanceDto> getRoadLineOrgyearSpendMoney(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 按年月统计信号灯报修金额
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午9:16
     */
    public List<MaintenanceDto> getSignLampOrgyearSpendMoney(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 按年月统计信号机报修金额
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午9:16
     */
    public List<MaintenanceDto> getSignalMachineOrgyearSpendMoney(Integer year, String orgIds) throws Exception;

    /**
     * @Description: 按年月统计太阳能报修金额
     * @Author: shao-yikun
     * @Date: 2017/11/20 下午9:16
     */
    public List<MaintenanceDto> getSolarEnergyOrgyearSpendMoney(Integer year, String orgIds) throws Exception;


    /**
     * @Description: 获取该公司所在地区
     * @author xu_jiaHui
     * @date 2017/12/19 18:12
     */
    public List<String> getAllInfo4Type(String type, Integer EquipmentType, String orgIds) throws Exception;

    /**
     * @Description: 获取指定范围内的标牌数量
     * @author xu_jiaHui
     * @date 2017/12/20 13:06
     */
    public List<ColligateDto> getAllRoadSignCountDT(DTRequestDto dtRequestDto, ColligateDto dto) throws Exception;

    public Integer getAllRoadSignCount(DTRequestDto dtRequestDto, ColligateDto dto) throws Exception;

    /**
     * @Descrption: 获取指定范围内的标杆数量
     * @author xu_jiaHui
     * @date 2017/12/20 20:57
     */
    public List<ColligateDto> getAllRoadPoleCountDT(DTRequestDto dtRequestDto, ColligateDto dto) throws Exception;

    public Integer getAllRoadPoleCount(DTRequestDto dtRequestDto, ColligateDto dto) throws Exception;

    public List<ColligateDto> getAllSignalLampCountDT(DTRequestDto dtRequestDto, ColligateDto dto) throws Exception;

    public Integer getAllSignalLampCount(DTRequestDto dtRequestDto, ColligateDto dto) throws Exception;

    public List<ColligateDto> getAllSignalMachineCountDT(DTRequestDto dtRequestDto, ColligateDto dto) throws Exception;

    public Integer getAllSignalMachineCount(DTRequestDto dtRequestDto, ColligateDto dto) throws Exception;

    public List<ColligateDto> getAllSolarEnergyCountDT(DTRequestDto dtRequestDto, ColligateDto dto) throws Exception;

    public Integer getAllSolarEnergyCount(DTRequestDto dtRequestDto, ColligateDto dto) throws Exception;

    public List<ColligateDto> getAllRoadLineCountDT(DTRequestDto dtRequestDto, ColligateDto dto) throws Exception;

    public Integer getAllRoadLineCount(DTRequestDto dtRequestDto, ColligateDto dto) throws Exception;

    public List<ColligateDto> getAllGuardrailCountDT(DTRequestDto dtRequestDto, ColligateDto dto) throws Exception;

    public Integer getAllGuardrailCount(DTRequestDto dtRequestDto, ColligateDto dto) throws Exception;

    public List<ColligateDto> getAllMonitorCountDT(DTRequestDto dtRequestDto, ColligateDto dto) throws Exception;

    public Integer getAllMonitorCount(DTRequestDto dtRequestDto, ColligateDto dto) throws Exception;

    public List<ColligateDto> getAllCoverCountDT(DTRequestDto dtRequestDto, ColligateDto dto) throws Exception;

    public Integer getAllCoverCount(DTRequestDto dtRequestDto, ColligateDto dto) throws Exception;

    public List<ColligateDto> getAllHighLeverCountDT(DTRequestDto dtRequestDto, ColligateDto dto) throws Exception;

    public Integer getAllHighLeverCount(DTRequestDto dtRequestDto, ColligateDto dto) throws Exception;


    /**
     * @Description: 获取指定OrgId的监管单位
     * @author xu_jiaHui
     * @date 2017/12/20 13:18
     */
    @Query(value = "select new com.hualude.roadsign.dto.OrgFatherAndChildDto(o.orgId,o.orgName) from OrgEntity as o,OrgFatherAndChildEntity as a where a.orgId=?1 and o.orgId=a.mainOrgId")
    public List<OrgFatherAndChildDto> getMainOrgNameByOrgId(Integer orgId) throws Exception;


    /**
     * @Description: 获取指定OrgId的养护单位
     * @author xu_jiaHui
     * @date 2017/12/20 13:18
     */
    @Query(value = "select new com.hualude.roadsign.dto.OrgFatherAndChildDto(o.orgId,o.orgName) from OrgEntity as o,OrgFatherAndChildEntity as a where a.mainOrgId=?1 and o.orgId=a.orgId")
    public List<OrgFatherAndChildDto> getChildOrgIdNameByOrgId(Integer orgId) throws Exception;

    /**
     * @Description: 获取公司类型
     * @author xu_jiaHui
     * @date 2017/12/20 13:35
     */
    @Query(value = "select orgType from OrgEntity where orgId=?1")
    public Integer getOrgType(Integer orgId) throws Exception;

    /**
     * @Description: 获取公司Id和Name
     * @author xu_jiaHui
     * @date 2017/12/20 13:53
     */
    @Query(value = "select new com.hualude.roadsign.dto.OrgFatherAndChildDto(orgId,orgName) from OrgEntity where orgId=?1")
    public List<OrgFatherAndChildDto> getOrgIdNameByOrgId(Integer orgId) throws Exception;

    /**
     * @Description: 管理员获取所有维护单位
     * @author xu_jiaHui
     * @date 2017/12/25 18:49
     */
    @Query(value = "select new com.hualude.roadsign.dto.OrgFatherAndChildDto(orgId,orgName) from OrgEntity where orgType=0")
    public List<OrgFatherAndChildDto> getAllCompanyOrgIdName() throws Exception;

    /**
     * @Description: 管理员获取所有监管单位
     * @author xu_jiaHui
     * @date 2017/12/25 18:51
     */
    @Query(value = "select new com.hualude.roadsign.dto.OrgFatherAndChildDto(orgId,orgName) from OrgEntity where orgType=1")
    public List<OrgFatherAndChildDto> getAllMainOrgIdName() throws Exception;

    /**
     * @Description: 获取置顶条件的故障列表
     * @author xu_jiaHui
     * @date 2017/12/21 18:58
     */
    public List<ColligateDto> getAllSolarEnergyFaultDT(DTRequestDto dtRequestDto, ColligateDto dto) throws Exception;

    public Integer getAllSolarEnergyFaultCount(DTRequestDto dtRequestDto, ColligateDto dto) throws Exception;

    public List<ColligateDto> getAllSignalLampFaultDT(DTRequestDto dtRequestDto, ColligateDto dto);

    public Integer getAllSignalLampFaultCount(DTRequestDto dtRequestDto, ColligateDto dto);

    public List<ColligateDto> getAllSignalMachineFaultDT(DTRequestDto dtRequestDto, ColligateDto dto);

    public Integer getAllSignalMachineFaultCount(DTRequestDto dtRequestDto, ColligateDto dto);

    public List<ColligateDto> getAllRoadLineFaultDT(DTRequestDto dtRequestDto, ColligateDto dto);

    public Integer getAllRoadLineFaultCount(DTRequestDto dtRequestDto, ColligateDto dto);

    public List<ColligateDto> getAllGuardrailFaultDT(DTRequestDto dtRequestDto, ColligateDto dto);

    public Integer getAllGuardrailFaultCount(DTRequestDto dtRequestDto, ColligateDto dto);

    public List<ColligateDto> getAllMonitorFaultDT(DTRequestDto dtRequestDto, ColligateDto dto);

    public Integer getAllMonitorFaultCount(DTRequestDto dtRequestDto, ColligateDto dto);

    public List<ColligateDto> getAllCoverFaultDT(DTRequestDto dtRequestDto, ColligateDto dto);

    public Integer getAllCoverFaultCount(DTRequestDto dtRequestDto, ColligateDto dto);

    public List<ColligateDto> getAllHighLeverFaultDT(DTRequestDto dtRequestDto, ColligateDto dto);

    public Integer getAllHighLeverFaultCount(DTRequestDto dtRequestDto, ColligateDto dto);


    public List<ColligateDto> getAllRoadSignFaultDT(DTRequestDto dtRequestDto, ColligateDto dto);

    public Integer getAllRoadSignFaultCount(DTRequestDto dtRequestDto, ColligateDto dto);

    public List<ColligateDto> getAllRoadSignMainFaultDT(DTRequestDto dtRequestDto, ColligateDto dto);

    public Integer getAllRoadSignFaulMaintCount(DTRequestDto dtRequestDto, ColligateDto dto);

}
